<include file="public@header" />
</head>
<body>
<style type="text/css">
	.aui_state_lock{
		top:50% !important;
		left: 50% !important;
		transform: translate(-50%,-50%);
	}
</style>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
	
			<li class="active" id="list"><a href="">预约列表</a></li>
			<li class="" id="list"><a href="{:url('Wxmeeting/meeting_detail',array('wx_secrect'=>session('wx_secrect')))}">预约详情</a></li>

		<!-- 	<li><a href="{:url('order/addorder')}">添加</a></li> -->
			<!-- 	<li><a href="{:url('user/add')}">{:lang('ADMIN_USER_ADD')}</a></li> -->
		</ul>
        <button type="button" class="btn btn-default search-switch" style="float:right;margin:10px 0" aria-label="Left Align">
            <span class="glyphicon glyphicon-list" aria-hidden="true"></span>按条件查询
        </button>
		<form class="well form-inline search-form" style="overflow:hidden;clear:right;display:none;" method="post" action="{:url('Wxmeeting/index')}">
		    员工名称:
			<input type="text" class="form-control" name="staff_name" value="{:session('staff_name')}" placeholder="请输入员工名称">
			<!-- 业务员名称:
			<input type="text" class="form-control" name="salesname" style="width: 140px;" value="" placeholder="请输入业务员名称"> -->
			<!-- 企业名称:
			<input type="text" class="form-control" name="commpany_name" style="width: 140px;" value="" placeholder="请输入业务员名称"> -->
			场地名称:
			<input type="text" class="form-control" name="site_name" value="{:session('site_name')}" placeholder="请输入客户名称">
			<!-- <br/><br/>
			时间:
			<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
			value="{$start_time|default=''}"
			style="width: 140px;" autocomplete="off">-
			<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
			value="{$end_time|default=''}"
			style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;  -->
			
			时间:
			<input type="text" class="form-control js-bootstrap-datetime" name="start_time"
			value="{:session('start_time')}" autocomplete="off">-
			<input type="text" class="form-control js-bootstrap-datetime" name="end_time"
			value="{:session('end_time')}" autocomplete="off">
				审核状态:
			<select class="form-control" name="audit_status">
				<option value='0' >请选择</option>
				<option value="1" <if condition="$audit_status eq 1">selected</if>>审核中</option>
				<option value="2" <if condition="$audit_status eq 2">selected</if>>审核通过</option>
				<option value="3" <if condition="$audit_status eq 3">selected</if>>审核失败</option>
				<option value="4" <if condition="$audit_status eq 4">selected</if>>取消预约</option>
			</select>	
            <div style="float:right;margin-top:10px;">
                <input type="submit" class="btn btn-primary" value="搜索" />
			    <a class="btn btn-danger" href="{:url('Wxmeeting/index')}">清空</a>
            </div>
		</form>
		<table class="table table-hover table-bordered" style="font-size:12px;">
			<thead>
				<tr>
					<th width="22%">场地</th>
					<th width="14%">姓名</th>
					<th width="14%">备注</th>
					<th width="25%">时间</th>
				<!-- 	<th width="5%">使用状态</th> -->
					<th width="20%">操作</th>
				</tr>
			</thead>
			<tbody>
				
				
				<foreach name="list" item="vo" key="k">
					<tr>
					    <input type="hidden" name="id" value="{$vo.id}">
					     <php>$img_url=cmf_get_image_preview_url($vo['pic']);</php>
						<!-- <td> <?php echo get_customer_name($vo['id']); ?></td> -->
						<td>{$vo.site_name}</td>
						<td>{$vo.staff_name}</td>
						<td>{$vo.remark}</td>
						<td style="word-break:break-all;"><?php echo date('m-d H:i',$vo['start_time']).date('m-d H:i',$vo['end_time']); ?></td>
						
					<!-- 	<td><switch name="$vo['is_using']" >
							<case value="1">未开始使用</case>
							<case value="2">使用中</case>
							<case value="3">使用结束</case>
							<case value="4">驳回使用</case>
							<case value="5">禁止使用</case>
							<case value="6">取消使用</case>
						
							<default />未开始使用
						</switch></td> -->
						

						<td>
						<!-- 	<a class='edit' href='{:url('Order/editOrder',array('id'=>$vo.id))}'>编辑</a> -->
						<if condition="($vo['is_audit'] eq 2 and $vo['audit_status'] eq 1) or  ($vo['is_audit'] eq 1 and $vo['audit_status'] eq 1)">
							
							<!-- | -->
							<div class='add_audit' style="color:#5bc0de;" id="{$vo['id']}">通过</div>
							<div class='add_cancel_audit' style="color:#d9534f;" id="{$vo['id']}">拒绝</div>
                            <a href="javascript:parent.imagePreviewDialog('{$vo['business_card']}');">查看名片</a>
						</if>	
							
							<!-- <if condition="$vo['id'] eq 2">
							
							<a class='cancel_del' id="{$vo.id}">取消禁用</a>
							<else />
							
							<a class='del' id="{$vo.id}">禁用</a>
							</if> -->
							
						</td>


					</tr>
				</foreach>
			</tbody>
		</table>
		<div class="pagination">{$page}</div>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>
<script>
	$(function(){
		stime="1";
		etime="2";
		cusname="1";
		spacname="2";
		commpany_name="3";
		salesman="2";
		if(spacname){
			$("input[name=space_name]").val(spacname);
		}
		if(salesman){
			$("input[name=salesname").val(salesman);
		}
		// if(cusname){
		// 	$("input[name=customer_name]").val(cusname);
		// }
		//alert(commpany_name);
		if(commpany_name){
			$("input[name=commpany_name]").val(commpany_name);
		}
		// if(stime){
		// 	$("input[name=start_time]").val(stime);
		// }
		// if(etime){
		// 	$("input[name=end_time]").val(etime);
		// }
	})
    $('.search-switch').click(function(){
        $('.search-form').toggle();        
    })
	$(".add_audit").click(function(){
		id=$(this).attr("id");
			if(confirm("是否通过审核？")){
				 $.post("{:url('Wxmeeting/add_audit')}",{id:id,cancel:1},function(data,status){
				 
				 	alert('审核成功');	
				 //	var wx_secrect = <?php echo session('wx_secrect'); ?>;
				 	//$("input[name=deposit_price]").val('0.00');
				 	location.href="{:url('index',array('wx_secrect'=>session('wx_secrect')))}";
				 })
			}
		
		   })	
	$(".add_cancel_audit").click(function(){
		id=$(this).attr("id");
			if(confirm("是否确定此审核不通过？")){
				 $.post("{:url('Wxmeeting/add_audit')}",{id:id,cancel:2},function(data,status){

				 	// alert('禁止通过成功');	
				 	var remark=prompt("请输入备注信息");
				 	// if (name!=null && name!="") {
				 	// 	document.write("你好，" + name + "！今天过得好吗？")
				 	// }
				 	$.post("{:url('Wxmeeting/remark')}",{id:id,remark:remark},function(data,status){
				 		//alert(data);
				 	})
				 	//$("input[name=deposit_price]").val('0.00');
				 	location.href="{:url('index',array('wx_secrect'=>session('wx_secrect')))}";
				 })
			}
		
		   })	
	$(".del").click(
	    function(){
	    if(confirm("确认要禁用吗")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('forbade_staff')}",
	    		{id:id,cancel:1},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);
	$(".cancel_del").click(
	    function(){
	    if(confirm("确认要取消禁用吗")){
	    	    var id=$(this).attr("id");
	    	    $.post("{:url('forbade_staff')}",
	    		{id:id,cancel:2},
	    		function(data,status){

	    			location.href="{:url('index')}";
	    		});
	    }
		
		
	    }
	);


	

</script>
